home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
CSUBR.LZH
/
XTOA.C
< prev
next >
Wrap
C/C++ Source or Header
|
1985-12-02
|
400b
|
20 lines
char *xtoa(xval, aval) /* convert 2 hex bytes to ascii */
int xval;
char *aval;
{
int i, temp;
char *save;
save = aval;
for (i=3; i >= 0; i--) {
temp = (xval >> (i*4)) & 0x0f; /* get next nibble */
if (temp > 9)
*aval++ = temp + ('A' - 10); /* A through F */
else
*aval++ = temp + '0'; /* 0 through 9 */
}
*aval = '\0'; /* add end of string */
return save;
}